/*

This do-file creates Appendix Table S5 

It uses June 2020 data and examines 
A) whether the applicant returned home March 2020 or later
	(=1 if they returned home in that window, ie plausibly as a result of COVID, =0 otherwise)
B) whether the applicant is still working
*/



use "${data}/g2g_phone_data_prepped", clear




loc first 1
label var lottery "Migrant"

eststo clear
foreach var in app_covid_return app_abroad {
    
	sum `var' if lottery==0
	loc mean = `r(mean)'

	eststo: areg `var' lottery, absorb(upazila_Clean) cluster(union_Clean)
		sum `var' if lottery==0
		estadd scalar ctrl_mean = `r(mean)'
}

local col1 " Outcome: & Applicant Returned & Applicant Still \\ "
local col2 " & Home after & Abroad as of \\"
local col3 " & March 2020 & June 2020 \\ \midrule"
esttab using "$tables/Table_S5.tex", keep(lottery) ///
	replace se tex label  mlabels(none) nonotes nonumbers nostar b(3) /// starlevels(* 0.1 ** 0.05 *** 0.01)
	stats(crtl_mean r2 N, fmt(2 2 0) labels("Non-Migrant Mean" "R-Squared" "Observations")) ///
	posthead(`col1' `col2' `col3')
